
puts '[info] begin to analyze evaluating result...'
begin
  iFile = File.open('evaluation_result_dup.txt','r')
  oFile = File.open('evaluation_analyze_dup.txt','w')
  oFile.write('ratio,MAE,algorithm')
  ratio = nil
  algorithm = nil
  error = nil
  iFile.each_line { |line|
    arr = line.split(' ')
    next if arr[0]!='[info]'|| arr[1]=='evaluatingSetRatio' || arr[1]=='begin'
    if arr[1] == 'trainingSetRatio'
      ratio = arr[3]
      next
    else
      algorithm = arr[1]
      error = arr[3]
      oFile.write("#{ratio},#{error},#{algorithm}")
    end
  }
ensure
  iFile.close if iFile != nil
 # oFile.close if oFile != nil
end

puts '[info] job done !!'


